home *** CD-ROM | disk | FTP | other *** search
- library DEBUG;
- {
- This example ISAPI.DLL library DEBUG is part of IntraBob version 3.0, and
- can be used to demostrate how to Test/Debug ISAPI.DLLs on a local machine
- (i.e. without the need for a Web Server).
-
- Steps:
- 1. Start Delphi 3
- 2. Load DEBUG.DPR (this file)
- 3. Specify "INTRABOB.EXE" as Hosting Application (Run | Parameters)
- 4. Run the DLL, which starts IntraBob
- 5. Click on the "submit" button to load the DEBUG ISAPI.DLL
- 6. Don't forget to close IntraBob to return to the Delphi 3 IDE
-
- Feedback is welcome in news://news.shoresoft.com/drbob.internet.tools,
- or by e-mail to bob@bolesian.nl
- }
- uses
- Windows, SysUtils, ISAPI;
-
- function GetExtensionVersion(var Ver: THSE_VERSION_INFO): BOOL; stdcall;
- begin
- Ver.dwExtensionVersion := $00010000; // 1.0 support
- Ver.lpszExtensionDesc := 'Delphi 3.0 ISAPI DLL'; // Description
- Result := True;
- end;
-
- function HttpExtensionProc(var ECB: TEXTENSION_CONTROL_BLOCK): DWORD; stdcall;
- const
- MaxBuf = 1024;
- var
- Buffer: Array[0..MaxBuf] of Char;
- Size: Integer;
- Str: String;
- begin
- ECB.lpszLogData := 'Bob Swart (aka Dr.Bob - www.drbob42.com)';
- ECB.dwHTTPStatusCode := 200;
- Str :=
- '<HTML>'#13#10 +
- '<HEAD>'#13#10 +
- '<TITLE>Dr.Bob''s ISAPI Debugger</TITLE>'#13#10 +
- '</HEAD>'#13#10 +
- '<BODY BGCOLOR=A7B7C7>'#13#10 +
- '<H1>Dr.Bob''s ISAPI Debugger</H1>'#13#10 +
- '<HR>'#13#10 +
- '<H3>Server Variables</H3>'#13#10 +
- '<UL>'#13#10;
- Size := MaxBuf;
- if ECB.GetServerVariable(ECB.ConnID,'SERVER_SOFTWARE', @Buffer, Size) then
- Str := Str + '<LI><B>SERVER_SOFTWARE:</B>'#13'<BR>' + StrPas(Buffer) + #13#10;
- Size := MaxBuf;
- if ECB.GetServerVariable(ECB.ConnID,'REQUEST_METHOD', @Buffer, Size) then
- Str := Str + '<LI><B>REQUEST_METHOD:</B>'#13'<BR>' + StrPas(Buffer) + #13#10;
- Size := MaxBuf;
- if ECB.GetServerVariable(ECB.ConnID,'CONTENT_LENGTH', @Buffer, Size) then
- Str := Str + '<LI><B>CONTENT_LENGTH:</B>'#13'<BR>' + StrPas(Buffer) + #13#10;
- Size := MaxBuf;
- if ECB.GetServerVariable(ECB.ConnID,'CONTENT_TYPE', @Buffer, Size) then
- Str := Str + '<LI><B>CONTENT_TYPE:</B>'#13'<BR>' + StrPas(Buffer) + #13#10;
- Size := MaxBuf;
- if ECB.GetServerVariable(ECB.ConnID,'QUERY_STRING', @Buffer, Size) then
- Str := Str + '<LI><B>QUERY_STRING:</B>'#13'<BR>' + StrPas(Buffer) + #13#10;
- Size := MaxBuf;
- if ECB.GetServerVariable(ECB.ConnID,'PATH_INFO', @Buffer, Size) then
- Str := Str + '<LI><B>PATH_INFO:</B>'#13'<BR>' + StrPas(Buffer) + #13#10;
- Size := MaxBuf;
- if ECB.GetServerVariable(ECB.ConnID,'URL', @Buffer, Size) then
- Str := Str + '<LI><B>URL:</B>'#13'<BR>' + StrPas(Buffer) + #13#10;
- Str := Str +
- '</UL>'#13#10 +
- '<HR>'#13#10 +
- '<H3>ECB Data:</H3>'#13#10 +
- '<UL>'#13#10 +
- '<LI><B>ECB.cbSize:</B>'#13'<BR>' + IntToStr(ECB.cbSize) + #13#10 +
- '<LI><B>ECB.dwVersion:</B>'#13'<BR>' + IntToStr(ECB.dwVersion) + #13#10 +
- '<LI><B>ECB.ConnID:</B>'#13'<BR>' + IntToStr(ECB.ConnID) + #13#10 +
- '<LI><B>ECB.lpszMethod:</B>'#13'<BR>' + ECB.lpszMethod + #13#10 +
- '<LI><B>ECB.lpszQueryString:</B>'#13'<BR>' + ECB.lpszQueryString + #13#10 +
- '<LI><B>ECB.lpszPathInfo:</B>'#13'<BR>' + ECB.lpszPathInfo + #13#10 +
- '<LI><B>ECB.lpszPathTranslated:</B>'#13'<BR>' + ECB.lpszPathTranslated + #13#10 +
- '<LI><B>ECB.cbTotalBytes:</B>'#13'<BR>' + IntToStr(ECB.cbTotalBytes) + #13#10 +
- '<LI><B>ECB.cbAvailable:</B>'#13'<BR>' + IntToStr(ECB.cbAvailable) + #13#10 +
- '<LI><B>ECB.lpszContentType:</B>'#13'<BR>' + ECB.lpszContentType + #13#10 +
- '<LI><B>ECB.lpbData:</B>'#13'<BR>' + StrPas(ECB.lpbData) + #13#10 +
- '</UL>'#13#10 +
- '<HR>'#13#10 +
- 'See also: <A HREF="http://www.drbob42.com">Dr.Bob''s Delphi Clinic</A>' +
- '</BODY>'#13#10 +
- '</HTML>'#13#10;
-
- Str := Format(
- 'HTTP/1.0 200 OK'#13#10+
- 'Content-Type: text/html'#13#10+
- 'Content-Length: %d'#13#10+
- 'Content:'#13#10#13#10'%s', [Length(Str), Str]);
-
- Size := Length(Str);
- ECB.WriteClient(ECB.ConnID, Pointer(Str), Size, 0);
- Result := HSE_STATUS_SUCCESS
- end;
-
- exports
- GetExtensionVersion,
- HttpExtensionProc;
-
- begin
- end.
-